const cos = 'https://dmn000001-1301065476.cos.ap-guangzhou.myqcloud.com/' // 腾讯云对象储存地址

/**
 * 枚举Node环境
 */
export enum EnumNodeEnv {
  Development = 'development',
  Production = 'production',
}

const apiEnv: EnumNodeEnv = process.env.NODE_ENV as EnumNodeEnv
console.info('当前Node环境：', apiEnv)

const envMap = {
  [EnumNodeEnv.Development]: {
    baseUrl: 'http://localhost:9999',
    // baseUrl: 'https://www.dmnuo.com/newAppraisal',
    // baseUrl: 'http://159.75.237.228:9091',
    uploadBiz: 'dev-user',
    cos,
  },
  [EnumNodeEnv.Production]: {
    // baseUrl: 'https://www.dmnuo.com/appraisal',
    baseUrl: 'https://www.dmnuo.com/newAppraisal',
    uploadBiz: 'user',
    cos,
  },
}

type Env<T extends EnumNodeEnv> = {
  apiEnv: T
} & (typeof envMap)[T]

function createEnv(apiEnv: EnumNodeEnv): Env<typeof apiEnv> {
  return Object.assign({ apiEnv }, envMap[apiEnv])
}

const env = createEnv(apiEnv)
export default env
